Adaptive median filter salt and pepper noise suppression approach for common path coherent dispersion spectrometer

The Common-path Coherent-dispersion Spectrometer (CODES), an exoplanet detection instrument, executes high-precision Radial Velocity (RV) inversions by recording the phase shifts of interference fringes. Salt-and-pepper noise caused by factors such as improper operation of the CCD probe/analog-to-digital converter and strong dark currents may interfere with the phase information of the fringe. This lowers the quality of the interfering fringe image and significantly interferes with the RV’s inversion. In this study, an adaptive median filtering algorithm (CODESmF) based on submaximum and subminimum values is designed to eliminate the interference fringe image's salt-and-pepper noise as well as to reduce RV error. This allows the interference fringe image's phase information to be retained more completely. The algorithm consists of two major modules. Pixel Sub-extreme-based Filtered Noise Monitoring Module: discriminates signal pixels and noise pixels based on the submaximum and subminimum values of the pixels in the filtering window. Adaptive Median Filter Noise Suppression Module: the signal pixel is kept at the original value output, the noise pixel serves as the filtering window's center pixel, and the adaptive median filtering procedure is repeated numerous times with various filtering window sizes. According to the experimental findings, the CODESmF outperforms comparable algorithms and works better at recovering interference fringes. More than 90% of the phase/RV error caused by salt-and-pepper noise is typically eliminated by the CODESmF algorithm, and in certain circumstances, it can even remove roughly 98% of the phase error.

www.nature.com/scientificreports/with interference information when it enters the Sagnac interferometer 13,14 , and then the light is scattered into two-dimensional interference fringes by the spectrometer before being detected by the CCD detector as a digital signal that can be processed.
During the acquisition of interference fringe images, a variety of factors lead to a large amount of random noise interference in the acquisition and transmission of the image signal, including instrumental noise, photon noise, background light or cosmic ray contamination, noise caused by intrinsic stellar photospheric activity, wavelength calibration errors and errors caused by CCD inhomogeneities [15][16][17] .The interference fringe image quality is reduced by these random noises, making the RV accuracy decrease dramatically.The noise can be classified according to its probability distribution as Gaussian noise 18 , gamma noise, salt-and-pepper noise 19 , Poisson noise, etc.Among them, random noise disturbances such as improper operation of CCD probes/analog-to-digital converters and the formation of hot pixels on pixels by strong dark currents can be regarded as salt-and-pepper noise 20 .It is a haphazard appearance of dark (pepper) or bright (salt) dots with either black pixels in bright parts or white pixels in dark areas.Since the high intensity and random distribution of the salt-and-pepper noise, when the salt-and-pepper noise appears on the interference fringe image, it will have a significant impact on the interference fringe image quality and RV inversion.
Presently, salt-and-pepper noise is eliminated using techniques like regularization, filtering, and machine learning.An adaptive TV-L1 (ATV1) denoising technique was presented by Thanh et al. 21,22 .This method includes adaptive regularization parameter estimation and can effectively handle images with high-density noise corruption.To identify patterns and similarities in the images that aid in the restoration process, support vector machines 23 and convolutional neural networks 24 are employed as learning tools.Literature 25 uses a blind denoiser based on generative adversarial networks and convolutional neural networks.The most popular and extensively used filtering technique for eliminating impulsive random noise interference is median filtering, which is based on sorting theory.It is most straightforward and efficient.Examples include Adaptive Median Filter (AMF) 26 , Progressive Switching Median Filter (PSMF) 27 , Modified Decision-Based Unsymmetric Trimmed Median Filter (MDBUFLOW) 28 , Based on Pixel Density Filter (BPDF) 29 , Noise adaptive fuzzy switching median filter (NAAF) 30 , and, switching median filter (NAFSMF) 30 .
The median filtering technique eliminates noise by substituting the singular value with the median value, which effectively filters out salt-and-pepper noise while preserving the edge and detail information of the image.The standard median filtering (SMF) algorithm 31 effectively smooths out background noise with a nonlinear filtering fashion but hard to discriminate between noise and signal points, which frequently causes blurring of image details.Numerous enhanced algorithms are suggested for this aim.The adaptive median filtering (AMF) algorithm 32 dynamically adjusts the filtering window size based on a predefined window size threshold, which improves the filtering effect on high-density noise.The algorithm uses a fixed window size threshold, which is unable to adaptively adjust the threshold for images with different noise densities, and increasing the window size one at a time is not only time-consuming but also causes image blurring.A selective adaptive median filter (SAMF) is suggested in the literature 33 .This filter first identifies the noisy pixels before dynamically adjusting the filter window size following the constraints until a suitable median is obtained to replace the noisy pixels.However, the replacement values produced by this technique when utilizing a large-size window are not only labor-intensive but also inefficient at replicating the original pixel information.Based on this, literature 34 suggests a median filter (MDBMF) based on improved decision-making, which processes only noisy pixels and judiciously increases the filter window size.This filter can greatly enhance the performance of high-density noise denoising and operate more quickly.Nevertheless, the method performs the step of keeping the original noise pixels for localized high-density noise, which has an impact on the system's denoising performance.WAN Fengfeng et al. 35 proposed an adaptive fuzzy median filtering algorithm, using the maximum-minimum method to detect noise, the fuzzy membership function is defined by the mean of the absolute gray difference between the suspected pixels and its neighborhood pixels which has been processed, and the suspected pixels are fuzzy classified by this function.XU Guangyu 36 proposed an Efficient Switching Median Filter.The pixel points are classified into signal and possible noise points using the two extreme values of the gray value of the image.Polar discard filtering and recursive filtering are performed using a filter window size of 3 × 3 to remove noise and maintain image details.The adaptive feedback median filter 37 detects corrupted or noisy pixels by decisively analyzing the neighbors.It predicts a local threshold by analyzing the neighbors to decide the adaptive nature of the feedback median filter.
In this study, an adaptive median filtering algorithm (CODESmF) based on the noise detector for submaximum and subminimum values is proposed, which consists of two basic steps, i.e., the noisy pixel points are identified using the submaximum and subminimum values noise detector, and the marked pixels are then repaired using adaptive median filtering.The modeling of salt-and-pepper noise is reviewed in Section "Salt-and-pepper noise model".The fundamentals of the adaptive median filtering algorithm based on the sub-extreme-based salt-and-pepper noise detector are discussed in Section "Algorithmic principles of CODESmF".The algorithm's experiments to handle interference fringe images are described in Section "Experimental results and analysis'' , along with assessment metrics based on RV/phase offset.The summary and conclusion are provided in Section "Summary".

Salt-and-pepper noise model
The term "salt-and-pepper noise, " also called "bipolar impulse noise, " refers to a type of bright and dark spot noise that is typically produced by image sensors, transmission channels, decoding procedures, etc.The image appears to have salt and pepper sprinkled haphazardly throughout (black negative noise points correspond to pepper, while the white positive noise points correspond to salt) 38 .The salt-and-pepper noise in the interference fringe image only affects a small portion of the pixels, the locations of the noise points are randomly distributed, and both positive and negative noise points are equally likely to exist.The amplitude of salt-and-pepper noise is nearly the same, it frequently corresponds to the maximum or minimum of the gray level, and the gray value of a pixel polluted by pepper noise has no bearing on the gray value of an uncontaminated pixel nearby.
Let I represent the original, noise-free interference fringe image with M × N in size.Then I (i,j) denote the gray value of the pixel with coordinates at position (i,j) in the interference fringe image, where ] represent the interval of gray values of all pixels in the interference fringe image I, so I i, j ∈ [Smin, Smax] .The original gray value of the pixel point will be changed to S min or S max when the interference fringe image is tainted with salt-and-pepper noise.Therefore, defining the interference fringe image contaminated by salt-and-pepper noise as A, the gray value of its pixel position as (i,j) is: where I(i,j) is the salt-and-pepper noise-free pixel point's gray value, p + q is the noise density, and S min and S max have the same probability, i.e., p = q.The probability distribution formula for salt-and-pepper noise is as follows, where Z denotes the gray value.Many times, saturation values a and b are taken to be the highest and lowest values that can be used in digital photographs.For an 8-bit image, this means that a = 0 (black) and b = 255 (white).
The CODES offers better energy efficiency and detection accuracy, while it also has more challenging data processing duties.Instead of measuring the wavelength drift of the stellar spectrum as is done by traditional radial velocity measurement instruments, the CODES converts the spectral lines of stellar light into interference fringes and calculates the RV by measuring the phase change of the interference fringes 39 .Three dimensions of information are present in two-dimensional interference fringes captured by a CCD: the interference dimension (direction) and the dispersion dimension (direction) on the target surface of the CCD detector, as well as the optical energy dimension represented by the light and dark variations of the interference fringes.Interference fringe images contain interference information in the slit direction, spectral information along the dispersion direction, and bright and dark variations of the fringes that capture information about light energy.The interference fringe's profile changes when either of its dimensions changes and this change in profile alters the interference fringe's phase information, making CODES more sensitive to external factors.Numerous instrument effects and ambient changes can be confused for velocity variations due to the equipment's exceptionally high sensitivity.The target signal travels through the telescope system and CODES before forming two-dimensional interference fringes on the CCD detector.The interference fringes' morphology is somewhat influenced by the mirror system, the focal plane system, the spectrometer system, the CCD camera, and other factors.Changes in the interference fringes might result from minor disturbances and show up as RV variations in the target star.S min or S max will take the place of the pixel point's original gray value when the interference fringe image has been contaminated with salt-and-pepper noise.The information carried by the interference fringes is severely disrupted when saltand-pepper noise shows up on them.This is manifested by a large error in the RV inversion.

Algorithmic principles of CODESmF
For salt-and-pepper noise, it is frequently the case that not all pixel points need to be processed and given values.When normal pixel points in an interference fringe image are filtered, the normal pixel points' pixel values are altered, destroying the original clean pixels and seriously distorting the image.
A switching median filtering processing strategy is suggested as a result: firstly, all pixels are classified into noise and signal pixels according to specific discriminative criteria; then, noise and signal pixels are processed individually, noise pixels are replaced with the neighborhood median value by spatial correlation, while signal pixels remaining with their original value.Processing success depends on the selection of the discriminationdetermining criteria.
As shown in Fig. 1 is a schematic diagram of the switched median filtering algorithm, where I (x,y) is the gray value of the center pixel point, then the output of the switched median filtering F (x,y) can be expressed by the following equation: (1) A i, j = S min , with probability p S max , with probability q I(i, j), with probability 1 − p − q , where M (x,y) is the median value of each pixel point within the current window, and T is a pre-determined threshold.

Image preprocessing
The filter window size of the median filtering algorithm can significantly affect the performance of the algorithm.For instance, it is important to utilize a bigger window when dealing with high-density noise, yet at this point, the median filtering algorithm struggles to preserve image details.The median filtering method has a drawback when the amount of salt-and-pepper noise is high: If the filtering window is too small and there are too many noisy pixels present, the gray value of the center pixel determined by the median filtering technique will be impacted by the noisy pixels.
By efficiently addressing the issues that median filtering methods have while dealing with high-density noise, dynamic windows can enhance the algorithms' performance 40 .The so-called dynamic window is used to design the filter window size of the median filtering algorithm, starting from a size of 3 × 3 and gradually increasing the size until the adaptive condition is satisfied or the size reaches a limit value 41 .Adaptive conditions can be selected according to the environment in which the median filtering algorithm is used.
It is also required to find a solution to the issue that some boundary pixel locations cannot generate filter windows after choosing the dynamic window approach.As demonstrated in Fig. 2, when a filter window of 3 × 3 size is chosen, the noisy pixel points at the image boundary cannot be processed because the window's center pixel is a pixel point at the image boundary and the window's coverage area is not filled with pixel points.
To address the above problems, this algorithm expands the boundaries of the image using a method based on mirror copying of the image boundaries 42 .Fold the R pixels near the image boundary outward, i.e., mirror copy the R pixels outward with the image boundary as the axis of symmetry.R stands for the maximum filter window's edge-centroid distance.The original image region is cropped to produce the filtered output image after filtering is complete.By using this technique, it is made sure that the pixel points at the edge of the image are filtered and that the expanded region retains the same grayscale characteristics as the edge of the image.
Equation ( 4) shows the corresponding grayscale matrix of an image, and the expanded image matrix ( 5) can be obtained by mirroring and copying 3 pixels outward for expansion. (3)

Salt-and-pepper noise detection based on submaximum and subminimum values
The threshold value T is used by conventional switching median filtering methods to assess whether a pixel point is contaminated or not.If the threshold T is set too high, certain salt-and-pepper noise points may be mistaken for non-salt-and-pepper noise points, making the processing impact less noticeable; similar to the above, if the threshold T is set too low, certain non-salt-and-pepper noise points may be mistaken for salt-and-pepper noise points, resulting in distortion in the processed image.This algorithm evaluates all of the pixel points using the submaximum and subminimum values salt-andpepper noise detector, as illustrated in Fig. 3, and the salt-and-pepper noise threshold range is defined by the next-largest and next-smallest pixel points surrounding the center pixel.The adaptive median filtering algorithm is used to process salt-and-pepper noise points outside the threshold range, while the original gray value is maintained for non-salt-and-pepper noise points inside the threshold range.
It is significant to note that the decision to use sub-extreme values rather than extreme values for detecting salt-and-pepper noise is due to the presence of emission/absorption peaks with larger/smaller gray values in the interference fringe image, which may be present in the form of extreme values within the filtering window.The extreme median filtering algorithm will then mistakenly categorize these pixel points as salt-and-pepper noise points, resulting in a loss of certain details in the interference fringe image and a disruption of the RV inversion.
Define the filter window W 2r + 1 (i,j), which is centered on the pixel point (i,j) and has the size (2r + 1) (2r + 1), W 2r + 1 (i,j) can be expressed as where r is a positive integer and I (i, j) denote the gray value of the pixel point (i,j).
Assuming that r = 1 and (x, y) is the filter window's center points, making W 3 (i,j) is a 3 × 3 sliding filter window centered on (x,y), eight-pixel points in the neighborhood of the center point (x,y) can be obtained as shown in Eq. (7), which in turn produces the second-largest value of the grayscale values in the filter window, f smax (x,y), and the second-smallest value of the grayscale values, f smin (x,y), as given in Eq. ( 8).
In Eq. ( 9), it is demonstrated that the range of salt-and-pepper noise judgment thresholds [α, β] can be calculated as the range of salt-and-pepper noise judgments within the window W 2r + 1 (i,j) based on f smax (x, y) and f smin (x,y), where γ is taken as an empirical value, γ = 0.25 ref 43 . (5) I(x, y − 1) I(x, y) I(x, y + 1) The pixel point at the window's center is identified as a non-salt-and-pepper noise point if its gray value, f (x,y), is within the range of [α,β].If f (x,y) falls outside the threshold range [α, β], the pixel point is identified to be a salt-and-pepper noise point.
where N stands for the collection of pixels affected by noise, and S stands for the collection of pixels unaffected by noise.If I(i, j) ∈ N , it is a noisy pixel, and if I(i, j) ∈ S , it is a signal pixel then.
A noise identification matrix K of equal size as the noise-containing image is defined to identify the noisy pixels.Each pixel in the noise-containing image is detected point-by-point using the procedure described in Eq. (8).If I(i, j) ∈ N , the corresponding position in matrix K is labeled 1, and if I(i, j) ∈ S , it is labeled as 0.

Adaptive median filtering
The interference fringe image A with noise contamination is subjected to mirror copying of the image boundary.With the image boundary as the axis of symmetry, R = 9 pixels are mirror copied outward to obtain the interference fringe noise image A after expanding the boundary.Each pixel of the image A is detected point by point, and it is determined whether it belongs to a noise pixel or not by using Eq. ( 10), thus obtaining the noise identification matrix K.
The pixel I (i, j) that corresponds to K = K 1 in image A is used as the center pixel for a median filtering opera- tion.The grayscale values of each pixel point in the filtering window W 2r + 1 (i,j) are sorted to create the sequence W sort (i,j), and the grayscale value of I (i, j) is replaced with the median value of the sequence W sort (i,j), M(x, y).
In this procedure, the filter window size W 2r + 1 (i,j) is gradually increased from 3 × 3 to 19 × 19, and the median filtering operation is repeatedly carried out.

Evaluation criteria based on RV/Phase offset
The Doppler effect 44,45 is caused by a shift in the radial component of the star's orbital speed along the direction of the Earth as it moves in a tiny circular orbit under the influence of the planet's gravitational pull.By detecting the periodic shift in the spectral Doppler induced by the planet's traction to the star, the RV approach infers the existence of planets indirectly.
The wavelength calculation formula for the Doppler effect is Among them, λ is the wavelength of the stellar spectral line received by the observer, λ 0 is the spectral line wavelength when the star radial velocity is 0, Δλ is the wavelength offset of the stellar spectral line, c is the speed of light 299792458 m/s, ν is the radial velocity of the star relative to the observer, and the movement away from the observer is positive.
Eq. ( 14) can be calculated by (13).In ( 14), the wavelength is converted into a wavenumber to represent, then (15) and ( 16) can be derived, where k represents the wavenumber of the stellar spectral line that the observer received, k 0 is the spectral line wavenumber when the star radial velocity is 0, Δk is the wavenumber offset of the stellar spectral line.
For a light source with an amplitude of I 0 and a wavenumber of k, the following formula can be used to determine the intensity of the interference fringes produced at the optical path difference (OPD) d: The OPD and the wave number k of the light source, as stated in (17), define the phase of the interference fringes.As a result, (18) shows the phase difference at the same OPD before and after the Doppler frequency shift.( 10)  16) into (18), the corresponding relationship between radial velocity ν and phase difference Δφ can be obtained, as shown in (19) and (20).
That is, after obtaining the phase difference Δφ of the interference fringes before and after the stellar Doppler frequency shift through CODES measurement, the corresponding stellar radial velocity ν can be calculated according to (20).
For the interference fringe image A with noise contamination, the salt-and-pepper noise interferes with the phase information carried by the interference fringes, resulting in an error in the phase difference �φ of the interference fringes that CODES eventually collected.As a result, the RV produced from the inversion is eventually biased.www.nature.com/scientificreports/Therefore, utilizing the efficiency of correcting the RV/phase offset as a criterion for algorithm evaluation, this work examines the denoising effect of the algorithm as well as the recovery of the interference fringe image.

Experimental data acquisition
The laser interference fringes obtained from the CODES principle verification device 11 are selected as the experimental objects to assess the effectiveness of the proposed algorithm.
The experimental CODES device was constructed in a clean, temperature-controlled laboratory.Fig 5 depicts the optical principle and the device's related arrangement, and Table 1 lists the specifications of the major optical parts.A He-Ne laser was selected as the narrowband light source.The interferometer subsystem consists of an unpolarized cube beam splitter, three mirrors, and four UV-fused silica cubes with a refractive index of 1.457 and a total length of 34 mm.Silica cubes produced a fixed OPD of 15.538 mm.The period of the interference fringe is adjusted by the pitch angle of the reflector AB.
The raw interference requires the following processing to extract the radial velocity data from the obtained interference fringes.The first is to subtract the base, whereby bias voltages cause the CCD to emit various numbers of electrons even in the absence of exposure, which must be eliminated while processing the interference fringe image.Specifically, the initial interferogram removes the background image that would exist if no light entered the coherent dispersion system.Figure 6 displays the first set of interference fringe images used as a test subject (every presentation after this one is based on the first set of interference fringe images).
The interference fringe images captured at six successive exposure periods were chosen as processing objects under identical experimental conditions.The interference brought on by changes in the surroundings on the  www.nature.com/scientificreports/images of different interference fringes can be disregarded because the time interval for image acquisition is less than two minutes.As just a small area of the image in Fig. 6(b) has the interference fringes, the region is extracted as a processing object.Six sets of interference fringe images are shown in Fig. 7, where eight spots with varying brightness, labeled 1-8, are selected.The light spots at these eight locations are utilized in the subsequent investigation to examine the algorithm's capacity to recover the interference fringes of light spots of various brightnesses.
For the experiments, 25 sampling sites with salt-and-pepper noise density values between 0.1 and 0.25 and at intervals of 0.01 were chosen.The interference fringe image acquired by CODES is double-type data with the salt noise point pixel value set to 2500.

Comparative experimental analysis
In this study, six sets of 16-bit grayscale maps are used as experimental subjects and compared with ACmF 46 , DAMRmF 47 , IBLF 48 , MMAPF 49 , and TSF 50 .All comparison algorithms use open-source code, and both the proposed methods and the comparison algorithms exclusively employ the parameters suggested in the published articles.Metrics for evaluation included direct observation and RV offset.A brief description of each comparison algorithm is provided below: ACmF: Replaces the standard median with the Cesáro average of the regular pixels to assign a new value to the window's center pixel.Recursive as well, ACmF has a maximum window size of 11 × 11 and can employ higher filter window sizes if needed.It works slowly due to the recursive process.
DAMRmF: Adaptive median filters and pixel weight functions were employed in the adaptive conditions.In the Riesz mean, substitute a pixel weight function for the pixel similarity.High-density salt-and-pepper noise was subsequently eliminated by adaptive conditions employing adaptive median filtering and modified Riesz mean.IBLF: The denoised images are obtained by generating intensity boundary-constrained images and reorganizing the generated boundary images.By extracting the lowest and higher extreme pixel values at each given place in the image, the boundary image maintains the edge data of the image.The rearrangement stage uses these divided boundary pictures to produce filtered images.
MMAPF: Impulse noise is removed using the change in the edge intensity values of the image and the difference in the edge intensity levels when using the minimum and maximum pools as the first layer.There are three programs within MMAPF.The first program is meant to enhance the less damaged images' performance.Using min-max pools layered differently, the second program divides the image in half and uses them to collect image transitions.In the final step, more precise edge and boundary information are obtained by reorganization and an averaging pooling operation.
TSF: A two-stage filter is proposed to remove the high-density salt-and-pepper noise from an image.TSF includes two main stages: high-density noise reduction and low-density noise removal.Based on the median of the weak original pixel values, the first stage eliminates high-density noise; the second stage removes low-density noise based on the median of the maximum repeated pixel values.TSF does not require iteration and operates quickly.Nevertheless, because there are few original pixels in the case of high-density noise, the damaged pixel's value is not accurately reflected by the median value of the weak original pixel.
To study the denoising effect and fringe recovery of the algorithm under different conditions.In the experiment, 25 sampling points were selected from 0. 01 to 0.25 as the density value of salt-and-pepper noise, at intervals of 0.01.8(a), which shows the interference fringe's three-dimensional contour at a salt-and-pepper noise density of 0.01.Two-dimensional interference fringe curves at three different wavelengths selected from Fig. 9 demonstrate the differences between the interference fringes before and after salt-and-pepper noise contamination.Among them, Fig. 10(a) records the interference fringes' 2D curves that aren't tainted by salt-and-pepper noise; Fig. 10(b)(c) shows the 2D curves of the interference fringes contaminated by pepper noise and salt noise, respectively.The eight peaks that run from left to right in Fig. 10(a) correspond to the eight interference fringe spots labeled in Fig. 7(a).
The mechanism through which salt-and-pepper noise results in RV errors in CODES is shown in Figs.9,10.The change in the center wavelength of the absorption/emission lines of the stellar light caused by planetary perturbations is what causes the RV in the target star.The center wavelength of the absorption/emission line and the phase of the stellar light fringe are directly correlated: when the fringe's phase is altered by shifting the central wavelength, a signal representing radial velocity is produced.The two-dimensional interference fringes recorded by CCD store information in three dimensions: interference information along the slit, spectral information along the dispersion, and energy information shown by the bright and dark spots.The interference fringes' profile is altered by the salt-and-pepper noise, which also modifies the energy information that the noisy image element records.Additionally, this alters the phase information that the interfering fringes carry, causing a mistake to be made in the computation of the interfering fringe phase variation Δφ, which ultimately leads to an inaccuracy in the RV inversion.
Figure 11 displays the interference fringes processed by the method developed in this study and the comparison algorithm, which shows six additional examples with noise densities of 0.01, 0.05, 0.10, 0.15, 0.20, and 0.25.First, a visual inspection of the denoised interference fringe image demonstrates that ACmF, DAMRmF, and TSF have poor peppercorn noise handling capabilities; even at low noise densities (e.g., 0.01), the peppercorn noise cannot be entirely eradicated.DAMRmF not only cannot effectively eliminate the pepper noise but even  aggravates the noise; the interference fringe image processed by DAMRmF will have a greater area of salt noise, which is more severe the higher the noise density.Although both TSF and CODESmF are capable of recovering interference fringes more effectively, TSF performs worse than CODESmF at removing salt-and-pepper noise.CODESmF still has an excellent ability to cancel the salt-and-pepper noise, even though there is an uncanceled salt noise spot in Fig. 11 (b5); it can be concluded that this is an isolated case and the noise pixel does not alter the phase information of the interference fringes.To a limited extent, the interference fringe image is somewhat better recovered by CODESmF, however, the interference fringes that are recovered exhibit dark blotches in the center of the spots, indicating that it is still insufficient for recovering targets with high gray values.In conclusion, intuitive examination reveals that CODESmF has a strong capability to recover interference fringes and remove salt-and-pepper noise.
When the interference fringes' bright and dark intensities differ, the denoising algorithm's results change.Eight different interference fringe spots are selected and the spot positions are shown in Fig. 7(a).The RV/phase offset between the interference fringe that is noise-contaminated and the interference fringe that has been subjected to the denoising procedure is the next step to take.When processing the interference fringes, the pixel points of the fringes are superimposed along the wavelength direction to prevent the chance of error brought on by the difference in the gray value of various fringe places.Eventually, an interference fringe curve representing this interference fringe image is obtained.A noise-free interference fringe image is processed using the aforementioned technique to produce an interference fringe curve I 1 ; an interference fringe image with added salt-and-pepper noise is processed to obtain an interference fringe curve I 2 ; and an interference fringe image after denoising is processed to obtain an interference fringe curve I 3 .Cubic spline interpolation was used to fit the interference fringes I 1 , I 2 , and I 3 .The phase shift Δφ1 of the interference fringes generated by noise and the phase shift Δφ2 of the interference fringes after denoising out can be computed based on the tiny variations of the interference fringes in the same period.The phase offset's direction is indicated by the positive and negative signs of the offset.The following equation can be used for calculating how much of a phase offset the denoising process has reduced.
where η off_rec reflects the ratio of phase error that the denoising method has fixed.( 22)  - www.nature.com/scientificreports/These six images, which range from Figs. 12, 13, 14, 15, 16 and 17 show the corrected phase errors as a percentage of the noise error for each algorithm for the eight spots of the first set interference fringe.A score close to 1 indicates a greater ability to recover the fringes.In this case, a negative number means that the algorithm's capacity to recover the interference fringes is so inadequate that it not only fails to reduce the error but significantly worsens the interference with the fringes' phase.The other comparison has a substantial number of recovery failures for the eight interference fringe spots carrying varying energies, and the probability of recovering the fringe failures increases with decreasing noise density.
Figure 12 shows that CODESmF performs exceptionally well in recovering interference fringes when their brightness is low.Regardless of the change in the salt-and-pepper noise density, CODESmF was able to reduce almost 70% of the phase error for the five low-brightness locations numbered 1-4 and numbered 8. (According to Eq. ( 21), there is a correlation between phase difference and RV; that is, more than 70% of the RV error could be removed.)Furthermore, CODESmF can remove over 90% of the phase error when the noise density is greater than 0.1, and in certain cases, up to 98%.The capacity of CODESmF for recovering the phase information of the interference fringe is reduced when the interference fringe is brighter.The presence of η off_rec being negative,   observed at the three brightest interferometric fringe spots numbered 5-7, indicates that the CODESmF algorithm is at the moment unable to recover the interferometric fringes and interfering with the phase information that the interferometric fringes are carrying.Nevertheless, this phenomenon is more concentrated and happens less frequently; it mostly affects spot 6 which is exposed to low-dense salt-and-pepper noise.Moreover, compared to the other low-luminance areas, less phase error is eliminated by the CODESmF method for the three places numbered 5-7 when the salt-and-pepper noise density is the same.Naturally, for high-brightness interference fringe locations, the CODESmF algorithm can still remove over 90% of the phase error in most circumstances.
Regarding the other comparison methods, there is a significant rise in the cases where η off_rec is negative.In particular, the TSF algorithm is nearly impossible to employ for interference fringe recovery because it typically fails to recover interference fringes and, in the few instances that it does, typically only removes less than 60% of the phase error.While the performance of the other four comparison algorithms surpasses that of the TSF method, it is still far below that of the CODESmF algorithm.Interferometric fringe spots with higher energy or interferometric fringes with a low concentration of noise interference cannot be recovered by these four

Figure 3 .
Figure 3. Schematic diagram of the sub-extreme-based adaptive median filtering algorithm.
Fig 4 depicts the algorithm's flow.

Figure 4 .
Figure 4. Algorithm flow schematic for the adaptive median filtering method using sub-extreme values.

Figure 5 .
Figure 5. (a) The set-up of CODES; (b) Schematic diagram of CODES.

Figure 6 .Figure 7 .
Figure 6.Base image and interference fringe image.(a) the base image; (b) the overall image after de-base.
Fig 8 displays the interference fringe images with various densities of salt-and-pepper noise added.Fig 9 is a three-dimensional schematic of Fig.

Figure 9 .Figure 10 .
Figure 9. 3D image of interference fringes with added salt-and-pepper noise.The noise density is 0.01.

Figure 12 .
Figure 12.Amount of phase deviation that has been corrected after CODESmF denoising.Sequentially in the horizontal direction are the eight interference fringe spots shown in Fig. 7(a), and vertical direction is the added noise density sequentially 0.01-0.25 (the same as below).

Figure 15 .
Figure 15.Amount of phase deviation that has been corrected after IBLF denoising.

Figure 17 .
Figure 17.Amount of phase deviation that has been corrected after TSF denoising.

Table 1 .
The parameters of the main optical elements.
Amount of phase deviation that has been corrected after MMAPF denoising.